package com.fengzhi.webcrawlers.jsoup;

import java.util.HashSet;
import java.util.Set;

import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class ImageParser extends BasicParser {

	public Set<String> getLinks(Element contentElement) {
		Elements linkElements = contentElement.getElementsByTag("a");

		if (linkElements == null) {
			return null;
		}

		Set<String> linkSet = new HashSet<String>();

		for (Element element : linkElements) {
			String url = element.attr("href");

			if (url.startsWith("#")) {
				continue;
			}

			linkSet.add(url);
		}

		return linkSet;
	}

}
